import java.awt.*;
import javax.swing.*;
import java.awt.Color;
@SuppressWarnings("serial")
public class View extends JFrame {
	// auf richtige reihenfolge achten! baut alles aufeinander auf!
	// buttons im panel, panel im frame, frame im tab
	public Buttons b = new Buttons();
	public Panels p = new Panels();
	public Tabs tabs = new Tabs();
	public JFrame f = new JFrame();
	
	//Buttons deklarieren, initialisieren und einstellen
 	public class Buttons{
		public JButton b1 = new JButton("Start Threads");
		public JButton b2 = new JButton("2. Projekt");
		Buttons(){
			b1.setSize(50,50);
			b1.setBackground(Color.PINK);
		}
	}
	//Panels deklarieren, initialisieren und einstellen
	public class Panels{
		public JPanel p1 = new JPanel();
		public JPanel p2 = new JPanel();
		Panels(){
			GridBagLayout gridbag = new GridBagLayout();
			GridBagConstraints c = new GridBagConstraints();
			
			GridLayout g = new GridLayout();
		//	g.fill = GridBagConstraints.BOTH;
			c.weightx = 1.0;
			JLabel p1l1 = new JLabel("Anzahl d. Threads", JLabel.CENTER);
			JLabel p1l2 = new JLabel("Anzahl d. Werte im BoolArray");
			
			//slider erstellen und eintstellungen setzen. very dirty
			JSlider sliderThreads = new JSlider();
				sliderThreads.setMinimum(0);
				sliderThreads.setMaximum(101);
				sliderThreads.setValue(51);
				sliderThreads.setMinorTickSpacing(10); 	//feinabstände
				sliderThreads.setMajorTickSpacing(20); 	//grobabstände
				sliderThreads.setSnapToTicks(false);	//autom. versetzen
				sliderThreads.setPaintTicks(true);
				sliderThreads.setPaintLabels(true);
				sliderThreads.setPaintTrack(true);
				sliderThreads.setBackground(Color.PINK);
//			JSlider sliderBool = new JSlider();
//				sliderBool.setMinimum(0);
//				sliderBool.setMaximum(50000000);
//				sliderBool.setValue(50000);
//				sliderBool.setMinorTickSpacing(10); 	//feinabstände
//				sliderBool.setMajorTickSpacing(20); 	//grobabstände
//				sliderBool.setSnapToTicks(false);	//autom. versetzen
//				sliderBool.setPaintTicks(true);
//				sliderBool.setPaintLabels(true);
//				sliderBool.setPaintTrack(true);
//				sliderBool.setBackground(Color.PINK);
				
			p1.setLayout( gridbag );
			p1.add( p1l1 );
			p1.add( p1l2 );
			p1.add( sliderThreads );
//			p1.add( sliderBool );
			p1.add( b.b1 );
			
			p1.setBackground(Color.PINK);
			
			//positionieren der elemente d.1. panels
			gridbag.setConstraints(b.b1, c);
			c.gridwidth = GridBagConstraints.REMAINDER;
			gridbag.setConstraints(p1l1, c);
			gridbag.setConstraints(sliderThreads, c);
			gridbag.setConstraints(b.b1,c);
			
			//--nächstes panel-------------------------------------------
			p2.add( b.b2 );
			p2.add( new JLabel("2. Prakt ", JLabel.CENTER));
			p2.setBackground(Color.GREEN);
		}
	}
	//klasse für die tabs
	public class Tabs{
		public JTabbedPane t1 = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
		public Tabs(){
			t1.addTab("Prakt 1",p.p1);
			t1.addTab("Prakt 2",p.p2);
		}
	}
	
	public View(){
//		b=new Buttons();
//		p=new Panels();
		
		//einstellungen des hauptrahmens
		f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		f.setSize(500, 200);

		f.add(tabs.t1);
		f.setVisible(true);
		
	}
	
}